<{include file="page/header.htm"}>
<div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                        <li>
                            <i class="fa fa-home"></i>
                            <a href="#">文章管理</a>
                        </li>
                        <li class="active">文章列表</li>
                    </ul>
                </div>
                <!-- /Page Breadcrumb -->
                
                <!-- Page Header -->
                <div class="page-header position-relative">
                    <div class="header-title">
                        <h1>
                            文章列表
                        </h1>
                        <small>
                                <i class="fa fa-angle-right"></i>
                                <{if $item}>编辑<{else}>添加<{/if}>文章
                       </small>
                    </div>
                    <!--Header Buttons-->
                    <div class="header-buttons">
                        <a class="sidebar-toggler" href="#">
                            <i class="fa fa-arrows-h"></i>
                        </a>
                        <a class="refresh" id="refresh-toggler" href="">
                            <i class="glyphicon glyphicon-refresh"></i>
                        </a>
                        <a class="fullscreen" id="fullscreen-toggler" href="#">
                            <i class="glyphicon glyphicon-fullscreen"></i>
                        </a>
                    </div>
                    <!--Header Buttons End-->
                </div>
                <!-- /Page Header -->
                <!-- Page Body -->
                <div class="page-body">
                
                  <{include file="page/msg.htm"}>
                
                <div class="row">
                                <div class="col-lg-12 col-sm-12 col-xs-12">
                                    <div class="widget radius-bordered">
                                        <div class="widget-header bg-themeprimary">
                                            <span class="widget-caption"><{if $item}>编辑<{else}>添加<{/if}>文章</span>
                                            <div class="widget-buttons">
                                               <button type="button" class="btn btn-success" onclick="window.location='<{url path='article'}>';"><i class="fa fa-mail-reply-all"></i>返回</button> 
                                            </div>
                                        </div>
                                        <div class="widget-body">
                                            <div class="row">
                                            	<div class="col-sm-6 col-xs-6">
                                                <form id="dataForm" method="post" class="form-horizontal" enctype="multipart/form-data" action="<{url path='article/edit'}>">
                                                 <input type="hidden" name="id" value="">
                                                 
                                                    <div class="form-group">
                                                        <label class="col-lg-4 control-label">标题<span class="red">*</span></label>
                                                        <div class="col-lg-8">
                                                            <input type="text" class="form-control"  name="title" id="title" datatype="*2-80"  nullmsg="标题不能为空!" errormsg="标题至少2个字符,最多36个字符！" />
                                                        </div>
                                                    </div>
                                                    
                                                   <div class="form-group">
                                                        <label class="col-lg-4 control-label">分类<span class="red">*</span></label>
                                                        <div class="col-lg-8">
                                                            <select class="form-control" name="cat_id" datatype="n" nullmsg="分类不能为空!">
                                                            	<option value="">请选择分类</option>
                                                                <{$categoryHtml}>
                                                            </select>
                                                        </div>
                                                    </div>

                                                   <div class="form-group">
                                                        <label class="col-lg-4 control-label">推荐</label>
                                                        <div class="col-lg-8">
                                                             <div class="checkbox">
                                                             
                                                             	<label>
                                                                    <input  name="flags[]" id="flagsc" value="c" type="checkbox">
                                                                    <span class="text">推荐[c]</span>
                                                                    <span> 将会推荐到网站首页 新闻中心板块 </span>
                                                                </label>
                                                                
																<!--
                                                                <label>
                                                                    <input  name="flags[]" id="flagsh" value="h" type="checkbox">
                                                                    <span class="text">头条[h]</span>
                                                                </label>
                                                                <label>
                                                                    <input  name="flags[]" id="flagsf" value="f" type="checkbox">
                                                                    <span class="text">幻灯[f]</span>
                                                                </label>
                                                                
                                                                <label>
                                                                    <input  name="flags[]" id="flagsb" value="b" type="checkbox">
                                                                    <span class="text">加粗[b]</span>
                                                                </label>
                                                                
                                                                <label>
                                                                    <input  name="flags[]" id="flagsp" value="p" type="checkbox">
                                                                    <span class="text">图片[p]</span>
                                                                </label>
                                                                <label>
                                                                    <input  name="flags[]" id="flagsj" value="j" onclick="ShowUrlTr(this)" type="checkbox">
                                                                    <span class="text">跳转[j]</span>
                                                                </label>
                                                                -->
                                                            </div>
                                                        </div>
                                                    </div>
                                                    
                                                    <div class="form-group" id="redirecturl_box" <{if !$item->redirecturl}> style="display:none"<{/if}>>
                                                        <label class="col-lg-4 control-label">跳转网址</label>
                                                        <div class="col-lg-8">
                                                            <input type="text" class="form-control" name="redirecturl"   datatype="url"  ignore="ignore" errormsg="请输入正确网址！"  />
                                                            <p class="help-block">如:http://www.scshux.com</p>
                                                        </div>
                                                    </div>
                                                                                                        
                                                   <div class="form-group">
                                                        <label class="col-lg-4 control-label">来源</label>
                                                        <div class="col-lg-8">
                                                            <input type="text" class="form-control" name="source"  value="" />
                                                        </div>
                                                    </div>
                                                    
                                                    <div class="form-group">
                                                        <label class="col-lg-4 control-label">SEO关键字</label>
                                                        <div class="col-lg-8">
                                                             <input type="text" class="form-control" name="seo_keywords"  value="" />
                                                              <p class="help-block">完善SEO关键字能为您的SEO带来更好的效果</p>
                                                        </div>
                                                    </div>
                                                    
                                                    <div class="form-group">
                                                        <label class="col-lg-4 control-label">SEO描述</label>
                                                        <div class="col-lg-8">
                                                            <textarea class="form-control" name="seo_description"></textarea>
                                                             <p class="help-block">(注:SEO描述同时也是简短描述)</p>
                                                        </div>
                                                    </div>
                                                    
                                                                                                        
                                                    <div class="form-group">
                                                        <label class="col-lg-4 control-label">排序</label>
                                                        <div class="col-lg-3">
                                                            <input type="text" class="form-control" name="sort" value="0" datatype="n"   ignore="ignore" />
                                                        </div>
                                                        
                                                        <label class="col-lg-2 control-label">点击次数</label>
                                                         
                                                        <div class="col-lg-3">
                                                            <input type="text" class="form-control" name="clicked" datatype="n" value="0"  ignore="ignore" errormsg="点击必须是整数！" />
                                                        </div>
                                                        
                                                    </div>
                                                    
                                                    <div class="form-group">
                                                        <label class="col-lg-4 control-label">缩 略 图</label>
                                                        <div class="col-lg-8">
                                                            <input type="file" name="pic"  accept=".jpeg,.jpg,.png,.git,.bmp"/>
                                                            <{if $item->pic }>
                                                            	<a target="_blank" href="<{$item->pic}>"><img src="<{$item->pic}>" width="100" height="50" /></a>
                                                            <{/if}>
                                                        </div>
                                                    </div>
                                                    
                                                    
                                                    <div class="form-group">
                                                        <label class="col-lg-4 control-label">内容</label>
                                                        <div class="col-lg-8">
                                                             <textarea id="content" name="content" style="width:700px;height:400px;"></textarea>
                                                        </div>
                                                    </div>

                                                
                                                    <div class="form-group">
                                                        <div class="col-lg-offset-4 col-lg-8">
                                                            <input class="btn btn-primary" type="submit" value="提交" />
                                                            <button type="button" class="btn btn-warning" onclick="window.location='<{url path='article'}>';">返回</button> 
                                                        </div>
                                                    </div>
                                            </form>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                
                            </div>  
                
                </div>
                <!-- /Page Body -->
            </div>
<{include file="page/footer.htm"}>
<script src="/skin/adminhtml/js/form.js"></script>
<script src="/skin/adminhtml/js/Validform.js"></script>
<script src="/skin/adminhtml/js/tools.js"></script>
<script charset="utf-8" src="/skin/adminhtml/assets/js/editors/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="/skin/adminhtml/assets/js/editors/kindeditor/lang/zh_CN.js"></script>

<script type="text/javascript">
    var UPLOADURL = "<{url path='tools/upload'}>";
	
	function ShowUrlTr(obj)
	{
		if(obj.checked){
			$("#redirecturl_box").show();
		}else{
			$("#redirecturl_box").hide();
			$("#redirecturl_box input").val('');
		}
	}
	
	$(document).ready(function () {
		validate('#dataForm');
	    var form = new Form('dataForm');
		
		form.init(<{json data=$item}>);
		<{if $item->flags}>
		form.setValue('flags[]',"<{$item->flags}>");
		<{/if}>
		
	    KindEditor.ready(function(K) {
                window.editor = K.create('#content',{
					uploadJson : '<{url path="tools/upload" }>',
					fileManagerJson : '<{url path="tools/filemanager" }>',
					allowFileManager : true,
					filterMode:false
				});
        });
		
	});
</script>